﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Admin.Master" Inherits="System.Web.Mvc.ViewPage" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Consumer Level - Open API Control Panel
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <fieldset>
        <legend>Consumer Manage &gt; Consumer Level &gt; List</legend>
        <table border="0" cellpadding="0" cellspacing="0" width="100%">
            <tr>
                <td width="140">
                    <strong>Consumer Level</strong>
                </td>
                <td width="160" align="center">
                    <strong>Consumer Level Name</strong>
                </td>
                <td align="center">
                    <strong>Manage</strong>
                </td>
            </tr>
            <%
                foreach (ConsumerLevelInfo lvl in ViewData["ConsumerLevels"] as List<ConsumerLevelInfo>)
                {
            %>
            <tr>
                <td>
                    <%= lvl.CONSUMER_LEVEL%>
                </td>
                <td align="center">
                    <%= lvl.CONSUMER_LEVEL_NAME%>
                </td>
                <td align="center">
                    [<%= Html.ActionLink("Methods", "Pop_MethodInLevel", "Consumer", new { id = lvl.CONSUMER_LEVEL }, new { @class = "nyroModal", @target = "_blank" })%>]
                    [<%= Html.ActionLink("Modify", "ConsumerLevelModify", "Consumer", new { id = lvl.CONSUMER_LEVEL }, null)%>]
                    [<a href="javascript:void(0);" onclick="javascript:DeleteConsumerLevel('<%= lvl.CONSUMER_LEVEL%>');">Delete</a>]
                </td>
            </tr>
            <%
                }
            %>
        </table>
        <input type="button" id="btnAddConsumerLevel" name="btnAddConsumerLevel" value="Add Consumer Level" />
    </fieldset>

    <script type="text/javascript" language="javascript">

        //json: Submit delete
        function DeleteConsumerLevel(consumer_level) {

            if (confirm('Are you sure delete?')) {

                $.post("/Consumer/AjaxDeleteConsumerLevel?" + new Date(), {
                    Action: "post",
                    consumer_level: consumer_level
                }, function(result) {
                    if (result.FLAG) {
                        alert("Success");
                        location.href = "/Consumer/ConsumerLevelList";
                    }
                    else {
                        alert(result.DESC);
                    }
                })
            }
        }


        $().ready(function() {
            $("#btnAddConsumerLevel").click(function() {
                location.href = "/Consumer/ConsumerLevelAdd";
            })
        })
    </script>

    <script type="text/javascript">
        $(function() {
            $.nyroModalSettings({ width: 650 });
        });
    </script>

</asp:Content>
